function plot_bar_plots_with_errorbar(xdata, ydata, ydataerr, bPlot, color_list)

barinfo = bar(xdata, ydata);
hold on

if length(barinfo) == 1
    
    barinfo.FaceColor = color_list{4};
    barinfo.BarWidth = 0.6;

    for ii = 1:length(xdata)
        plot([xdata(ii) xdata(ii)], [ydata(ii)-ydataerr(ii) ydata(ii)+ydataerr(ii)], 'color', color_list{3}, 'linewidth', bPlot.LineWidth)
    end
    
elseif length(barinfo) == 2
    
    barinfo(1).FaceColor = color_list{1};
    barinfo(2).FaceColor = color_list{2};
    
    for ii = 1:length(xdata)
        plot([xdata(ii) xdata(ii)]-barinfo(1).BarWidth/5, [ydata(ii,1)-ydataerr(ii,1) ydata(ii,1)+ydataerr(ii,1)], 'color', 'k', 'linewidth', bPlot.LineWidth)
        plot([xdata(ii) xdata(ii)]+barinfo(2).BarWidth/5, [ydata(ii,2)-ydataerr(ii,2) ydata(ii,2)+ydataerr(ii,2)], 'color', 'k', 'linewidth', bPlot.LineWidth)
    end
    
end

end